package com.cskaoyan.day8;

import java.util.Scanner;

public class ScannerUtils {
    static Scanner sc = new Scanner(System.in);

    public static String getString() {
        System.out.println("请输入您需要的字符串");
        return sc.nextLine();
    }

    public static int getInt() {
        System.out.println("请输入您需要的int型整数");
        return Integer.parseInt(sc.nextLine());
    }

    public static PersonA getPersonA() {
        System.out.println("请输入您需要的Person对象的名字和年龄");
        String name = sc.nextLine();
        String age = sc.nextLine();
        return new PersonA(name, age);
    }

    public static void main(String[] args) {
        System.out.println(ScannerUtils.getInt());
        System.out.println(ScannerUtils.getString());
        System.out.println(ScannerUtils.getPersonA());
    }

}

class PersonA {
    String name;
    String age;

    public PersonA(String name, String age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "PersonA{" +
                "name='" + name + '\'' +
                ", age='" + age + '\'' +
                '}';
    }
}
